const express = require('express');

//实例化服务器应用
let app = express();

//实现静态服务器 可以被直接访问
app.use(express.static("static"));

//实现自定义接口
app.get('/api/userList', (request, response) => {
    response.json({
        state: "ok",
        userList: [
            { username: "小明", sex: "男" },
            { username: "小黑", sex: "男" },
            { username: "小白", sex: "女" }
        ]
    })
})

//启动服务器
app.listen(10000, () => {
    console.log("server is running on 10000 port");
})